cmake_minimum_required (VERSION 2.8.8)

set (PROJECT cppjabberd)

file(GLOB INTERFACES interfaces/*.hpp)
file(GLOB SOURCES src/*)
file(GLOB TESTS_SOURCES testssrc/*)
set (GMOCK_FILES thirdparty/googlemock/gtest/src/gtest-all.cc thirdparty/googlemock/src/gmock-all.cc thirdparty/googlemock/src/gmock_main.cc)
	
set (Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)

set (Boost_USE_MULTITHREADED ON)

set (BOOST_COMPONENTS
	date_time
	regex
	system
	thread)
	
find_package (Boost 1.47.0 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
execute_process(COMMAND svn co http://googlemock.googlecode.com/svn/trunk/ thirdparty/googlemock)

project (${PROJECT})

# main binary
add_executable (${PROJECT} ${INTERFACES} ${SOURCES} main.cpp thirdparty/cppsaxxmlparser.hpp)

get_target_property(inc ${PROJECT} INCLUDE_DIRECTORIES)
include_directories(${Boost_INCLUDE_DIRS} interfaces)
target_link_libraries(${PROJECT} ${Boost_LIBRARIES})
add_definitions(-DBOOST_ALL_DYN_LINK)

# tests binary
add_executable (tests-${PROJECT} ${TESTS_SOURCES} ${INTERFACES} ${SOURCES} ${GMOCK_FILES} thirdparty/cppsaxxmlparser.hpp)
target_link_libraries(tests-${PROJECT} ${Boost_LIBRARIES})
include_directories(src thirdparty thirdparty/googlemock/gtest thirdparty/googlemock/gtest/include thirdparty/googlemock thirdparty/googlemock/include)
add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=0)

source_group(Interfaces FILES ${INTERFACES})
source_group(Sources FILES ${SOURCES})
source_group(TestsSources FILES ${TESTS_SOURCES})
